// a1.js
import Crypto from 'crypto-js'

const VITE_SIGN_ACCESS_KEY = 'bbx2'
const VITE_SIGN_SECRET_KEY = 'VuHpqfjzdnktp47C'
// 保留原有的 createSignHeader 函数
export const createSignHeader = (path, params, gmt) => {
  const body_string = JSON.stringify(params || '')
  const signing_string = ['POST', gmt, VITE_SIGN_ACCESS_KEY, path, '', body_string, ''].join('\n')
  const signature = Crypto.enc.Base64.stringify(
    Crypto.HmacSHA256(signing_string, VITE_SIGN_SECRET_KEY)
  )
  return {
    dt: gmt,
    ak: VITE_SIGN_ACCESS_KEY,
    sg: signature
  }
}
